import { IPSSysMsgTempl } from '../msg/ipssys-msg-templ';
import { IPSSysWFSetting } from './ipssys-wfsetting';
import { IPSWFUtilUIAction } from './ipswfutil-uiaction';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysWFSettingImpl extends PSModelObjectImpl implements IPSSysWFSetting {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pswfutiluiactions: IPSWFUtilUIAction[] | null = null;

  getPSWFUtilUIActions(): IPSWFUtilUIAction[] | null {
    if (this.pswfutiluiactions == null) {
      this.pswfutiluiactions = this.fillChildListModel(this.M.getPSWFUtilUIActions, 'wf.IPSWFUtilUIAction') as IPSWFUtilUIAction[];
    }
    return this.pswfutiluiactions;
  }

  get psWFUtilUIActions(): IPSWFUtilUIAction[] | null {
    return this.getPSWFUtilUIActions();
  }

  findPSWFUtilUIAction(objKey: any): IPSWFUtilUIAction | null {
    return this.getPSModel5('wf.IPSWFUtilUIAction', this.getPSWFUtilUIActions(), objKey) as IPSWFUtilUIAction;
  }

  protected remindpssysmsgtempl: IPSSysMsgTempl | null = null;

  getRemindPSSysMsgTempl(): IPSSysMsgTempl | null {
    if (this.remindpssysmsgtempl != null) return this.remindpssysmsgtempl;
    const value = this.M.getRemindPSSysMsgTempl;
    if (value == null) {
      return null;
    }
    this.remindpssysmsgtempl = this.getPSModel4('msg.IPSSysMsgTempl', value, 'getRemindPSSysMsgTempl') as IPSSysMsgTempl;
    return this.remindpssysmsgtempl;
  }

  get remindPSSysMsgTempl(): IPSSysMsgTempl | null {
    return this.getRemindPSSysMsgTempl();
  }

  getRemindPSSysMsgTemplMust(): IPSSysMsgTempl {
    const value = this.getRemindPSSysMsgTempl();
    if (value == null) {
      throw new Error('未指定催办消息模板');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSSysWFSettingImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'wf.IPSSysWFSetting') return true;
    return super.instanceof(cls);
  }
}
